import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)
    // 导入页面组件
import login from '@/views/login'
import layout from '@/views/layout'
import home from '@/views/home'
import my from '@/views/my'
import qa from '@/views/qa'
import video from '@/views/video'
import search from '@/views/search'
import article from '@/views/article'
const routes = [{
        path: '/login',
        component: login
    },
    {
        path: '/search',
        component: search
    },
    {
        path: '/article/:articleId',
        component: article,
        name: 'article', //命名路由
        props: true
    }, {
        path: '/',
        component: layout,
        children: [{
                path: '',
                component: home
            },
            {
                path: 'qa',
                component: qa
            },
            {
                path: 'my',
                component: my
            },
            {
                path: 'video',
                component: video
            }
        ]
    }
]

const router = new VueRouter({
    routes
})

export default router